gtkthemingengine: Fix a definite use of an uninitialised variable
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 20 Nov 2013 17:35:04 +0000 (17:35 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 2 Dec 2013 10:36:26 +0000 (10:36 +0000)
At this point, segments[1] is always uninitialised, and is used to
initialise itself. Looking at the code in the branch above, this appears
to have been a typo from segments[0], as segments[1] seems to typically
be 2 * segments[0].

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760

gtk/gtkthemingengine.c

index 18f7f7403b13be3d154a8b82cf71d50e382c4ad9..775fd6ba200971d870ec6aaca5f155d9a2459e75 100644 (file)
@@ -1478,7 +1478,7 @@ set_stroke_style (cairo_t        *cr,
           n = round ((1. / 3) * n);
 
           segments[0] = n ? (1. / 3) * length / n : 1;
-          segments[1] = 2 * segments[1];
+          segments[1] = 2 * segments[0];
         }
       cairo_set_dash (cr, segments, G_N_ELEMENTS (segments), 0);